<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

	<section class="content-header">
		<h1>医疗机构采购目录详情</h1>
		<ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">医疗机构采购目录查询</a></li>
            <li class="active"><a href="#">按医疗机构查询</a></li>
        </ol>
	</section>

	<section class="content">
		<div class=" box box-success">
			<div class="box-body">
				<div class="input">
					<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugName" name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugCode" name="drugCode"  placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
                    </div>
					<div class="textalign"><spring:message code="message.listForm.PeiSongQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                         <input type="text" class="textinput" id="psCompName" name="psCompName"  placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" />
                    </div>
				</div>
				<div class="input" style="margin-top:3px">
					 <div class="textalign1"><spring:message code="message.listForm.BeiAnLeiXing"/><spring:message code="message.yanZheng.maoHao"/></div> 
                        <div class="boxinput">
                        <select class="textinput" id="isLongTimePlan" name="isLongTimePlan">
                            <option value=""><spring:message code="message.select.option"/></option>
							<option value="0"><spring:message code="message.listForm.LinShiBeiAn"/></option>
                            <option value="1"><spring:message code="message.listForm.ChangQiBeiAnLeiXing"/></option>
                        </select>
                    </div>
					<div class="textalign" >
					<button type="button" onclick="gridSerch()" class="btn btn-success btn-sm"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
				</div>
				</div>
			</div>
		</div>
		
		<table class="jqgrid" id="list4"></table>
		<div id="prowed2"></div>
		
		
		<div class=" box box-warning bottongroup" id="bottongroup">
			<a href="javascript:history.go(-1)" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
		</div>
 
	</section>
	
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
	<script type="text/javascript">
	//绑定回车
    $('#drugName,#drugCode,#prodComp,#bakDrugFlag').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#drugName").focus();//加载页面光标在第一个查询框内
	
	
		function showDrugInfo(drugId) {
	        $.HN.dialog.open({
	            "id": "showDrugInfo", 
	            "title": "<spring:message code="message.listForm.YaoPinXinXi"/>", 
	            "url": "${ctx}/stdDrug/drugInfoDetail.html?drugId="+drugId,
	            "data": {}, 
	            "width": 800, 
	            "height": 400, 
	            "closefunc":function() {
	                
	            }
	        });
	    }
		
		function showCompInfo(prodCompId) {
            $.HN.dialog.open({
                "id": "showCompInfo", 
                "title": "<spring:message code="message.listForm.ShengChanQiYeXinXi"/>", 
                "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }
		
		function showPsCompInfo(compId) {
            $.HN.dialog.open({
                "id": "showPsCompInfo", 
                "title": "<spring:message code="message.listForm.ShengChanQiYeXinXi"/>", 
                "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+compId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }

		
	   $(function () {
			jQuery("#list4").jqGrid({
			    url: "${ctx}/hospCatalog/getCatalogByHospSC.html",
			    mtype: "POST",
			    postData:{"hospCode":"${hospInfo.hospCode}"},
			    datatype: "json",
			    autowidth: true,
			    shrinkToFit:false,
			    height: 270,
			    colNames:[
			              'drugId',
			              '<spring:message code="message.listForm.yaoPinBianMa"/>',
		                  '<spring:message code="message.listForm.tongYongMing"/>', 
		                  '<spring:message code="message.listForm.jiXing"/>',
		                  '<spring:message code="message.listForm.guiGe"/>',
		                  '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
		                  '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
		                  '<spring:message code="message.listForm.caiZhi"/>',
			              'prodCompId',
			              'compId',
			              '<spring:message code="message.listForm.PeiSongQiYe"/>',
			              '<spring:message code="message.listForm.shangBianMa"/>',
			              '<spring:message code="message.listForm.CaiGouJia"/>',
			              '<spring:message code="message.listForm.CaiGouXianJia"/>',
			              '<spring:message code="message.listForm.ZuiGaoLingShouJia"/>',
			              '<spring:message code="message.lable.suoShuXiangMu"/>',
			              '<spring:message code="message.listForm.YaoPinFenLei"/>',
			              '<spring:message code="message.listForm.IsorNoBeiAn"/>',
			              '<spring:message code="message.listForm.BeiAnLeiXing"/>'
			              ],
			    colModel:[
			        {name: 'drugId',hidden:true, width: 20 , align:"center" ,sortable: false},
			        {name:'drugCode',index:'drugCode', width:100, align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                        	return '<a href="javascript:showDrugInfo(\''+ row.drugId +'\');">'+cellvalue+'</a>';
                        }
                    },
			        {name:'drugName',index:'drugName', width:180, sortable: false , align:"center"},
			        {name:'formName',index:'formName', width:100, align:"center"},
			        {name:'specName',index:'specName', width:100 , align:"center",sortable: false},
			        {name:'factor',index:'factor', width:80, align:"center",sortable: false},
			        {name:'unit',index:'unit', width:80, align:"center",sortable: false},
			        {name:'materialName',index:'materialName', width:80, align:"center",sortable: false},
			        {name: 'prodCompId',hidden:true, width: 20 , align:"center" ,sortable: false},
			        {name: 'compId',hidden:true, width: 20 , align:"center" ,sortable: false},
			        {name:'psCompName',index:'psCompName', width:180 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
							if (cellvalue != null) {
                                return '<a href="javascript:showPsCompInfo(\''+ row.compId +'\');">'+cellvalue+'</a>';
							} else {
								return "";
							}
                        }
			        },
			        {name:'goodsCode',index:'goods_code',  align:"center", width:120, sorttype:"date"},
			        {name:'proPrice',index:'proPrice', width:100 , align:"right",sortable: false,
                 	   formatter:function(cellvalue, options, row){
                           return formatAmount(cellvalue, options, row);
                       }},
			        {name:'proPriceLimit',index:'proPriceLimit', width:100 , align:"right",sortable: false},
			        {name:'retailPriceLimit',index:'retailPriceLimit', width:100 , align:"right",sortable: false},
			        {name:'projName',hidden:true, index:'projName', width:180 , align:"center",sortable: false},
			        {name:'drugCatName',index:'drugCatName', width:100 , align:"center",sortable: false},
			        {name:'bakDrugFlag',index:'bakDrugFlag', width:100 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return cellvalue == 5 ? "<spring:message code="message.listForm.shi"/>" : "<spring:message code="message.listForm.fou"/>";
                        }
			        },
			        {name:'isLongTimePlan',index:'isLongTimePlan', width:100 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                        	var str = "";
                        	if (row.bakDrugFlag == 5) {
                        		str = cellvalue == 1 ? "<spring:message code="message.listForm.ChangQiBeiAnLeiXing"/>" : "<spring:message code="message.listForm.LinShiBeiAn"/>";
                        	}
                        	return str;
                        }
                    }
			    ],
			     rowNum: 20,
			     rowList: [10, 20, 50,100],
			     rownumbers: true,
			     multiselect: false,
			     pager: "#prowed2",
			     viewrecords: true,
			     gridComplete:function(){
	                	//序号列宽度自适应（参数为jqgridID）
	                    autoRNWidth("gridlist");
	                	//数据只有一条时默认选中（参数为jqgridID）
	                    selectByOneData("gridlist");
	                },
			     caption: "${hospInfo.hospName}",
			     editurl:"proPlanItemListHis.jsp",
			     jsonReader: {
			         repeatitems: false,
			         id: "ids"
			     }
			});
			     
			jQuery("#list4").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
			$(window).trigger("resize");
			    
		});
		
	   
		function gridSerch() {
		    var drugCode = $.trim($("#drugCode").val());
		    var drugName = $.trim($("#drugName").val());
		    var psCompName = $.trim($("#psCompName").val());
		    var isLongTimePlan = $("#isLongTimePlan").val();
		    $("#list4").jqGrid('setGridParam',{  
		        datatype:'json',
		        postData:{ 
		                "drugCode":drugCode,
		                "drugName":drugName,
		                "psCompName":psCompName,
		                "isLongTimePlan":isLongTimePlan
		        },
		        page:1
		    }).trigger("reloadGrid"); //重新载入  
		}
</script>
</body>
</html>